package cn.edu.hizee.gps.model;

import javax.persistence.*;
import java.util.Objects;

/**
 * @author ZX
 */
@Entity
@Table(name = "t_contact", schema = "EHelp")
public class Contact {
    private int id;
    private int userId;
    private String contactName;
    private String contactPhone;
    private String contactPassword;
    private Integer isDisable;
    private Integer status;


    public Contact(int userId, String contactName, String contactPhone, String contactPassword) {
        this.userId = userId;
        this.contactName = contactName;
        this.contactPhone = contactPhone;
        this.contactPassword = contactPassword;
    }

    public Contact() {
    }

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_id")
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "contact_name")
    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    @Basic
    @Column(name = "contact_phone")
    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    @Basic
    @Column(name = "contact_password")
    public String getContactPassword() {
        return contactPassword;
    }

    public void setContactPassword(String contactPassword) {
        this.contactPassword = contactPassword;
    }

    @Basic
    @Column(name = "is_disable")
    public Integer getIsDisable() {
        return isDisable;
    }

    public void setIsDisable(Integer isDisable) {
        this.isDisable = isDisable;
    }

    @Basic
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Contact contact = (Contact) o;
        return id == contact.id &&
                userId == contact.userId &&
                Objects.equals(contactName, contact.contactName) &&
                Objects.equals(contactPhone, contact.contactPhone) &&
                Objects.equals(contactPassword, contact.contactPassword) &&
                Objects.equals(isDisable, contact.isDisable) &&
                Objects.equals(status, contact.status);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, contactName, contactPhone, contactPassword, isDisable, status);
    }

    @Override
    public String toString() {
        return "Contact{" +
                "id=" + id +
                ", userId=" + userId +
                ", contactName='" + contactName + '\'' +
                ", contactPhone='" + contactPhone + '\'' +
                ", contactPassword='" + contactPassword + '\'' +
                ", isDisable=" + isDisable +
                ", status=" + status +
                '}';
    }
}
